﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Ch9_Portable.Models;

namespace Ch9RSS_WP8
{
    public partial class SectionPage : PhoneApplicationPage
    {
        public SectionPage()
        {
            InitializeComponent();
            this.DataContext = App.SectionVM;
        }

        private void itemGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems != null & e.AddedItems.Count == 1)
            {
                var selectedItem = (Ch9Item)e.AddedItems[0];
                App.ItemVM.SetCh9Item(selectedItem);
                NavigationService.Navigate(new Uri("/ItemPage.xaml", UriKind.Relative));
                
            }
        }
    }
}